package com.gxuwz.medical.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.gxuwz.medical.domain.person.Person;

/**
 * 参合人员档案管理数据访问层
 * @ClassName: PersonDao
 * @author SunYi
 * @Date 2019年4月28日上午11:37:24
 */
public class PersonDao extends GenericDao<Person> {
	
	/**
	 * 实现ResultSet结果集转换为Person类型实例
	 * @author SunYi
	 * @Date 2019年4月28日上午11:37:24
	 */
	@Override
	protected Person handle(ResultSet rs) throws SQLException {
		try{
			// 实例化参合人员档案对象
			Person model = new Person();
			// 取出ResultSet的值,存进Person对象
			model.setFamilyCode(rs.getString("familyCode"));
			model.setNongheCard(rs.getString("nongheCard"));
			model.setMedicalCard(rs.getString("medicalCard"));
			model.setHouseNum(rs.getString("houseNum"));
			model.setRelationship(rs.getString("relationship"));
			model.setIdCard(rs.getString("IdCard"));
			model.setName(rs.getString("name"));
			model.setGender(rs.getString("gender"));
			model.setAge(rs.getInt("age"));
			model.setBirthDate(rs.getDate("birthDate"));
			model.setNation(rs.getString("nation"));
			model.setHealth(rs.getString("health"));
			model.setEducation(rs.getString("education"));
			model.setWorkType(rs.getString("workType"));
			model.setIsRuralHukou(rs.getString("isRuralHukou"));
			model.setCareer(rs.getString("career"));
			model.setWorkUnit(rs.getString("workUnit"));
			model.setTelephone(rs.getString("telephone"));
			model.setLiveAddress(rs.getString("liveAddress"));
			model.setContact(rs.getString("contact"));
			// 返回参合人员档案对象
			return model;
		}catch(SQLException e){
			throw new SQLException("结果集转为实例失败!",e);
		}
	}

}
